/**
 * @file linked_queue.h
 * Definition file for a generic LinkedQueue data structure
 * @author Denis Ollier
 * @ingroup LinkedQueue
 *
 * @todo Documentation
 * @todo Comment functions.
 */

#ifndef LINKED_QUEUE_H
#define LINKED_QUEUE_H

#include <yadl_common.h>

/** The generic LinkedQueue data structure */
struct linked_queue {
	struct cell* first_cell;
	struct cell* last_cell;
};

/** The LinkedQueue object */
typedef struct linked_queue* linked_queue;

/**
 *
 * @param qu
 */
void linked_queue_dispose (linked_queue qu);

/**
 *
 * @param qu
 * @retval 0
 * @retval 1
 */
unsigned int linked_queue_is_empty (linked_queue qu);

/**
 *
 * @return
 * @retval NULL
 */
linked_queue linked_queue_new (void);

/**
 * Inserts the specified element into this linked_queue
 */
unsigned int linked_queue_offer (linked_queue qu, void* element);

/**
 * Retrieves, but does not remove, the head of this linked_queue, or returns null if this linked_queue is empty.
 */
void* linked_queue_peek (linked_queue qu);

/**
 * Retrieves and removes the head of this linked_queue, or returns null if this linked_queue is empty.
 */
void* linked_queue_poll (linked_queue qu);

int linked_queue_search (linked_queue qu, void* element);

#endif /* LINKED_QUEUE_H */
